﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebSite1.DataSet1TableAdapters;
using WebSite1.DataSet2TableAdapters;

namespace WebSite1
{
    public partial class wed : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click1(object sender, EventArgs e)
        {
            if (Session["UserID"] == null)
            {
                Generic_Data_Cheker gench = new Generic_Data_Cheker();
                int newuserid = (int)gench.UserIDIdentity("", "", "", "", "", "", "Guest", " ", "Anonynouse user");
                Session["UserID"] = newuserid.ToString();

            }
            wishlistsTableAdapter a = new wishlistsTableAdapter();
            wedding_dataTableAdapter weddata = new wedding_dataTableAdapter();
            int newwhishlistid = (int)a.InsertQuery(DateTime.Now, male_fname_TextBox.Text + " " + male_fname_TextBox.Text + " and " + female_fname_TextBox.Text + " " + female_lname_TextBox.Text, 1);
            user_whishlistTableAdapter u = new user_whishlistTableAdapter();
            u.Insert(Int32.Parse(Session["UserID"].ToString()), newwhishlistid);
            //string a2 = male_fname_TextBox.Text;

            //weddata.Insert(male_fname_TextBox.Text)
            Session["CurrentWishListID"] = newwhishlistid;
            weddata.Insert(male_fname_TextBox.Text,
                           male_lname_TextBox.Text,
                           male_email_TextBox.Text,
                           female_fname_TextBox.Text,
                           female_lname_TextBox.Text,
                           female_email_TextBox.Text,
                           wedd_date_TextBox.Text,
                           wedd_place_TextBox.Text, 
                           newwhishlistid);
            Response.Redirect("whishlist.aspx");
       

        }
    }
}